package com.consumer.controller;

import javax.annotation.Resource;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class DemoController {

  @Resource
  private RestTemplate restTemplate;


  @GetMapping( "name")
  public String getMessage(String name) {
    return restTemplate.getForObject("http://nacos-discovery-provider/demo?port="+System.getProperty("server.port")+"?name=" + name,String.class);
  }

}
